Skip to content
This repository was archived by the owner on Jan 4, 2019. It is now read-only.

Emit more specific security state change events #92

Merged
merged 2 commits into from
Nov 11, 2016

Conversation

diracdeltas
Copy link
Member

break;
default: break;
if (explanations.ran_insecure_content) {
Emit("security-style-changed", "active-mixed-content");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't we already have something for active and passive mixed content? @darkdh ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine to consolidate here, just don't want to duplicate

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bridiver, we have did-display-insecure-content for passive mixed content and did-run-insecure-content for active one. https://github.com/brave/electron/blob/master/atom/renderer/content_settings_client.cc#L408-L424

Copy link
Collaborator

@bridiver bridiver Nov 11, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@diracdeltas - I think we might be mixing the meanings of these things a little bit. active and passive mixed content are metadata about the current security style. The explanations also have a summary and description that would be useful for the ui so maybe this should emit more fields? Maybe the security style (without passive or active), the summary and description (from explanations.secure_explanations, unauthenticated_explanations or broken_explanations as appropriate to the security style) and then two bools for ran and displayed insecure content? It looks like there can actually be more than one explanation for the current state so maybe we should use a converter to map the explanations to an array of hashes [{summary: "..", desc: "..."}, ...]. No reason to worry about a fromV8 converter because we never send them back

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@darkdh I think we can also keep the existing event because it provides the url and this doesn't appear to

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually forget about the two bools, let's just convert the SecurityStyleExplanations to a javascript object with whatever fields we want to hold everything

Copy link
Member Author

@diracdeltas diracdeltas Nov 11, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so it turns out that this change does cause problems with @darkdh's handling of active mixed content. however, it's still needed for passive mixed content (which has a SecurityStyle of 'insecure' but should be treated by Brave front-end as secure), so i'm pushing a commit now to just fix that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i agree this should emit all the information available in some kind of object; will do after this release

} else if (explanations.displayed_insecure_content) {
Emit("security-style-changed", "passive-mixed-content");
} else {
Emit("security-style-changed", security_style);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++ on name change and converter

diracdeltas added a commit to brave/browser-laptop that referenced this pull request Nov 11, 2016
Requires brave/muon#92
Fix #5524

Auditors: @darkdh @bridiver

Test Plan: covered by automated test
default: break;
if (explanations.displayed_insecure_content &&
security_style == content::SECURITY_STYLE_UNAUTHENTICATED) {
Emit("security-style-changed", "passive-mixed-content");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really think we're passing through the wrong info here. passive-mixed-content is additional information about the security style and it should be a 3rd param imo because it's somewhat independent of the security style

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@diracdeltas your last comment didn't show up on github and I just now saw the email. I'll merge

@bridiver bridiver merged commit 9a3b788 into master Nov 11, 2016
@bsclifton bsclifton deleted the feature/more-security-styles branch June 18, 2018 18:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants